package com.aurora.controller;

import com.aurora.utils.RedisUtil;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.data.redis.core.RedisTemplate;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;

/**
 * @author 浅夏的猫
 * @description 资源controller
 * @date 22:38 2024/1/13
 */
@RestController
@RequestMapping("/resource")
public class ResourceController {

    private static Logger logger = LoggerFactory.getLogger(ResourceController.class);

    @Resource
    private RedisUtil redisUtil;

    /**
     * @return java.util.List<com.aurora.entity.ResourceEntity>
     * @description 查询全部资源数据列表
     * @author 浅夏的猫
     * @date 22:40 2024/1/13
     */
    @RequestMapping("/get")
    public String get() {
        redisUtil.set("aurora", "小白");
        Object aurora = redisUtil.get("aurora") == null ? "" : redisUtil.get("aurora");
        logger.info("测试获取值:{}", aurora.toString());
        return aurora.toString();
    }
}
